package fatboy.hypeerweb;

import org.junit.Assert;
import org.junit.Test;



public class TestSurfaceNodeState {
	/**
	 * test returns on getters
	 */
	@Test
	public void testGetters(){
		Connection web = new Connection();
		web.addNode("first");
		Node testing = web.addNode("second");
		web.addNode("third");
		NodeState test = testing.getNodeState();
		Assert.assertFalse(test.hasEdgeChild(testing));
		Assert.assertTrue(test.hasParent(testing));
		Assert.assertEquals(2, test.getFirstUpDownNodeAddress(testing).hashCode());
		
	}
	
	/**
	 * This test case test the branch coverage of hasParent method.
	 * Tests both branches of hasParent on an artificially
	 * 	created stand alone surface node.
	 * 
	 * By Ilya Vinogradov
	 */
	@Test
	public void testHasParent() {
		Node testSurfaceNode = new Node("surface", NodeType.SURFACE_NODE, new NodeAddress(0));
		Assert.assertFalse(testSurfaceNode.getNodeState().hasParent(testSurfaceNode));
	}
}
